package week4.day319.demo1;

/**
 * @Package: week4.day319.demo1
 * @Author: yanjiali
 * @Created: 2024/3/19 16:03
 */
public class Main {
    public static void main(String[] args) {
        Animal animal = new Pup();

        if(animal instanceof Pup) {
            Pup pup = (Pup) animal;
            pup.setColour("黑色");
            pup.setName("来福");
            pup.eatBone();
            System.out.println(pup.toString());
        }else if(animal instanceof Dog){
            Dog dog = (Dog) animal;
            dog.eatBone();
        }
    }
}
